<template>
    <mt-swipe :auto="4000">
        <mt-swipe-item v-for="(img, index) in imgs" :key="index">
            <img :src="img.img || img.src" alt="">
        </mt-swipe-item>
    </mt-swipe>
</template>
<script>
export default {
  name: 'my-swipe',
  props: ['url'],
  data () {
    return {
      imgs: []
    }
  },
  created () {
    this.$axios
      .get(this.url)
      .then(res => {
        this.imgs = res.data.message
      })
      .catch(err => console.log('获取首页或商品详情页轮播图异常', err))
  }
}
</script>
<style lang="less" scoped>
.mint-swipe {
  height: 200px;
}
img {
  width: 100%;
  height: 200px;
  object-fit: fill;
}
</style>
